<?php
//用户注册页面
include("common.inc.php");
InitGP(array("action","username","password","password2","email","subscribe","commit")); //初始化变量全局返回
if(!empty($_USERS))dheader("index.php");//如果已经登录直接跳转到首页
if (!empty($commit) && $action="reg") {
		//处理注册操作
	if (empty($username)||empty($password)||empty($password2)||empty($email)) {
		$ERROR_MSG ="用户名密碼和E-mail必須填寫！";
	}
	if ($password!=$password2) {
		$ERROR_MSG ="兩次輸入的密碼不一樣！";
	}
	$subscribe=$subscribe=1?1:0;
	if (empty($ERROR_MSG)) {
		include(INC_PATH."/member.class.php");
		$m=new memberclass();
		$msg=$m->reg($username,$password,$email); //注册动作
		if ($subscribe==1) {
			//执行插入邮件发送列表操作
			@list($uid, $uname,$pwd) = explode("\t", cookie_authcode(get_cookie('loginauth'),'DECODE'));
			include(INC_PATH."/mail.class.php");
			$mail=new MailClass();
			$mail->add($email,$uid);
			$uid=$uname=$pwd="";
		}
		if ($msg=="OK") {
			dheader("index.php");//php跳转页面
		}else {
			$ERROR_MSG =$msg;		
		}
		
	}
}
//显示注册表单
include template('reg');//包含输出指定模板

?>